Skip to content

Conversation

@jonathanpeppers
Copy link
Member

We noticed dotnet trace output was showing:

21.28ms (0.45%) java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)

This code path was introduced by a new feature in 1f27ab5.

For now, I think we can rewrite this to use the char overload of
IndexOf, as well as the regular indexer on string.

After these changes, I get a better time:

1.21ms java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)

We may have just moved the location that ICU is loaded, but this
change is good regardless.

We noticed `dotnet trace` output was showing:

    21.28ms (0.45%) java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)

This code path was introduced by a new feature in 1f27ab5.

For now, I think we can rewrite this to use the `char` overload of
`IndexOf`, as well as the regular indexer on `string`.

After these changes, I get a better time:

    1.21ms java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)

We may have just *moved* the location that ICU is loaded, but this
change is good regardless.
@jonathanpeppers jonathanpeppers requested a review from jonpryor June 29, 2022 22:00
@jonathanpeppers
Copy link
Member Author

The next place that is loading ICU, is back to .NET 6 behavior:

image

Probably not avoidable:

https://github.com/xamarin/xamarin-android/blob/e1611871aa84d25a47e7f71a7b8b87bf5f19932b/src/Mono.Android/Java.Interop/TypeManager.cs#L26

@jonpryor
Copy link
Contributor

StringComparer.Ordinal brings in ICU?!

That feels like dotnet/runtime should be fixed.

    src/Java.Interop/Java.Interop/JniTypeSignatureAttribute.cs:                     JniRuntime.JniTypeManager.AssertSimpleReference (simpleReference, nameof (simpleReference));

Not all codepaths use `jniSimpleReference`.  Use `argumentName` for the argument name.
@jonpryor jonpryor merged commit 920ea64 into main Jun 30, 2022
@jonpryor jonpryor deleted the AssertSimpleReference branch June 30, 2022 01:05
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done & Blogged

Development

Successfully merging this pull request may close these issues.

4 participants